/*
 * PerformanceController
 *
 * Copyright (c) 2018 Manulife International Ltd.
 *
 * Description: Initial data for user detail
 *
 * Maintenance History
 *
 * YYMMDD  Who              Reason
 * ======= ================ ====================================================
 * 180411  Cherry Xu        Application development
 */
package com.manulife.hk.performance.datamodel;

import org.springframework.stereotype.Component;

import com.manulife.hk.performance.model.IssueSale;
import com.manulife.hk.performance.model.SalesMap;
import com.manulife.hk.performance.model.ValidateList;
import com.manulife.hk.performance.model.SubmitSale;

@Component
public class UserModel {

	/**
	 * Initial user name for issuesale
	 *
	 * @param issueSales
	 *            IssueSales
	 * @return IssueSales object
	 */

	public ValidateList<IssueSale> setIssueSalesUserName(ValidateList<IssueSale> issueSales, String userName) {
		for (IssueSale issueSale : issueSales) {
			// if(StringUtils.isEmpty(issueSale.getLastUpdateUser())) {
			issueSale.setLastUpdateUser(userName);
			// }
		}

		return issueSales;
	}

	/**
	 * Initial user name for salesMap
	 *
	 * @param salesMaps
	 *            SalesMaps
	 * @return SalesMaps object
	 */
	public ValidateList<SalesMap> setSalesMapUserName(ValidateList<SalesMap> salesMaps, String userName) {
		for (SalesMap salesMap : salesMaps) {
			// if(StringUtils.isEmpty(salesMap.getLastUpdateUser())) {
			salesMap.setLastUpdateUser(userName);
			// }
		}

		return salesMaps;
	}

	/**
	 * Initial user name for salesMap
	 *
	 * @param salesMaps
	 *            SalesMaps
	 * @return SalesMaps object
	 */
	public ValidateList<SubmitSale> setSubmitSalesUserName(ValidateList<SubmitSale> submitSales, String userName) {
		for (SubmitSale submitSale : submitSales) {
			// if(StringUtils.isEmpty(submitSale.getLastUpdateUser())) {
			submitSale.setLastUpdateUser(userName);
			// }
		}

		return submitSales;
	}
}
